<?php
$dis_id=3;
include("../../inc/conn.inc");
include("../islogin2.php");
    if($per_row["m_type"]=="3")
    {
        checkCount("news");
    }

if($_POST[act]){
 $_POST["news_keyword"]=delwords($_POST["news_keyword"]);
  $_POST["news_title"]=delwords($_POST["news_title"]);
   $_POST["news_content"]=delwords($_POST["news_content"]);
$c_rs_1=mysql_query("select type_name from news_type where id='$_POST[catalog_1]'");
$c_row_1=mysql_fetch_array($c_rs_1);
$c_rs_2=mysql_query("select type_name from news_type where id='$_POST[catalog_2]'");
$c_row_2=mysql_fetch_array($c_rs_2);
$c_rs_3=mysql_query("select type_name from news_type where id='$_POST[catalog_3]'");
$c_row_3=mysql_fetch_array($c_rs_3);
$catalog_1=($_POST[catalog_1])?$_POST[catalog_1]:0;
$catalog_2=($_POST[catalog_2])?$_POST[catalog_2]:0;
$catalog_3=($_POST[catalog_3])?$_POST[catalog_3]:0;

mysql_query("insert into news (news_title,member_id,news_keyword,type_id,type_name,type_id2,type_name2,type_id3,type_name3,news_content,start_time ,end_time,news_time,picture) values ('$_POST[news_title]','".$_COOKIE['user_id']."','$_POST[news_keyword]','$catalog_1','$c_row_1[type_name]','$catalog_2','$c_row_2[type_name]','$catalog_3','$c_row_3[type_name]','$_POST[news_content]','$_POST[start_time]','$_POST[end_time]','".date("Y-m-d H:i:s")."','$_POST[picture]')");

echo "<script>alert('发布成功');location='expo.php'</script>";

}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js" charset="gb2312"></script>
<body>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 展会 &gt;&gt; 发布展会信息</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">发布展会信息</TD>
   </TR>
</TABLE>
<br>
<script language = "JavaScript">    
var onecount;
onecount=0;
subcat=new Array();
subcat[0]=new Array("展会","0","22");
subcat[1]=new Array("国内会展","22","27");
subcat[2]=new Array("国际会展","22","28");
subcat[3]=new Array("工业、机械、加工","27","29");
subcat[4]=new Array("汽车、交通工具","27","30");
subcat[5]=new Array("IT设备、数码、软件","27","31");
subcat[6]=new Array("通信、通讯、电子","27","32");
subcat[7]=new Array("海洋、航空、航天","27","33");
subcat[8]=new Array("化工、能源、环保","27","34");
subcat[9]=new Array("建筑、装潢、五金","27","35");
subcat[10]=new Array("家居、家电、日用品","27","36");
subcat[11]=new Array("服饰、皮革、纺织","27","37");
subcat[12]=new Array("玩具、礼品、工艺品","27","38");
subcat[13]=new Array("生物、医药、保健","27","39");
subcat[14]=new Array("旅游、酒店、餐饮","27","40");
subcat[15]=new Array("食品、饮料、酒","27","41");
subcat[16]=new Array("首饰、美容、化妆品","27","42");
subcat[17]=new Array("影视、娱乐、体育","27","43");
subcat[18]=new Array("媒体、广告、出版","27","44");
subcat[19]=new Array("印刷、包装、纸业","27","45");
subcat[20]=new Array("运输、物流、仓储","27","46");
subcat[21]=new Array("金融、保险、审计","27","47");
subcat[22]=new Array("投资、连锁、加盟","27","48");
subcat[23]=new Array("加工、贸易、进出口","27","49");
subcat[24]=new Array("办公、文教、艺术","27","50");
subcat[25]=new Array("农、林、牧、渔","27","51");
subcat[26]=new Array("公共、安防、智能","27","52");
subcat[27]=new Array("综合、跨行业类","27","53");
subcat[28]=new Array("其他行业","27","54");
subcat[29]=new Array("工业、机械、加工","28","55");
subcat[30]=new Array("汽车、交通工具","28","56");
subcat[31]=new Array("IT设备、数码、软件","28","57");
subcat[32]=new Array("通信、通讯、电子","28","58");
subcat[33]=new Array("海洋、航空、航天","28","59");
subcat[34]=new Array("化工、能源、环保","28","60");
subcat[35]=new Array("建筑、装潢、五金","28","61");
subcat[36]=new Array("家居、家电、日用品","28","62");
subcat[37]=new Array("服饰、皮革、纺织","28","63");
subcat[38]=new Array("玩具、礼品、工艺品","28","64");
subcat[39]=new Array("生物、医药、保健","28","65");
subcat[40]=new Array("旅游、酒店、餐饮","28","66");
subcat[41]=new Array("食品、饮料、酒","28","67");
subcat[42]=new Array("首饰、美容、化妆品","28","68");
subcat[43]=new Array("影视、娱乐、体育","28","69");
subcat[44]=new Array("媒体、广告、出版","28","70");
subcat[45]=new Array("印刷、包装、纸业","28","71");
subcat[46]=new Array("运输、物流、仓储","28","72");
subcat[47]=new Array("金融、保险、审计","28","73");
subcat[48]=new Array("投资、连锁、加盟","28","74");
subcat[49]=new Array("加工、贸易、进出口","28","75");
subcat[50]=new Array("办公、文教、艺术","28","76");
subcat[51]=new Array("农、林、牧、渔","28","77");
subcat[52]=new Array("公共、安防、智能","28","78");
subcat[53]=new Array("综合、跨行业类","28","79");
subcat[54]=new Array("其他行业","28","80");
onecount=55;  //联动函数    
function changelocation(locationid){   
   document.form1.catalog_2.length=0;     
   var locationid=locationid;   
   var i;   
   for(i=0;i<onecount;i++){   
       if(i==0){     
          document.form1.catalog_2.options[document.form1.catalog_2.length]=new Option("--二级分类--","");
		  }   
       if(subcat[i][1]==locationid){     
          document.form1.catalog_2.options[document.form1.catalog_2.length]=new Option(subcat[i][0],subcat[i][2]);   
          }                   
    }   
}
function changelocation2(locationid2)   
{   
document.form1.catalog_3.length=0;     
var locationid2=locationid2;   
var i2;   
for (i2=0;i2<onecount;i2++){   
     if(i2==0){     
         document.form1.catalog_3.options[document.form1.catalog_3.length]=new Option("--三级分类--","");     
         }   
     if(subcat[i2][1]==locationid2){     
         document.form1.catalog_3.options[document.form1.catalog_3.length]=new Option(subcat[i2][0],   subcat[i2][2]);   
         }                   
     }   
}
</script>
<TABLE width="100%" border="0" cellpadding="0" cellSpacing="1" bgcolor="#C1DCF5">
        <TBODY>
        <form method="post" action="" name="form1" onSubmit="return checkform()">
          <TR>
            <td width="17%" height="25" align="right" bgcolor="#EFF6FF">展会主题&nbsp;<font color="#FF0000">*</font></td>
            <TD width="83%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="news_title" id="news_title" type="text" size="50" maxlength="200"></TD>
          </TR>
		 <TR>
            <td width="17%" height="25" align="right" bgcolor="#EFF6FF">展会关键字&nbsp;<font color="#FF0000">*</font></td>
            <TD width="83%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="news_keyword" id="news_keyword" type="text" size="40" maxlength="120"></TD>
          </TR>
          <TR>
            <td height="25" align="right" bgcolor="#EFF6FF">展会目录<span style="padding-left:4px;line-height:35px;">&nbsp;<font color="#FF0000">*</font></span></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;line-height:35px;">

<select name="catalog_1" id="catalog_1" onChange="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)" style="width:120px;">
 <option value="">--选择大类--</option>   
  <option value="22">展会</option> 
</select>&nbsp;<select name="catalog_2" id="catalog_2" onFocus="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)" style="width:120px;">
  <option value="">--选择二级分类--</option>
</select>&nbsp;<select name="catalog_3" id="catalog_3" onFocus="changelocation2(document.form1.catalog_2.options[document.form1.catalog_2.selectedIndex].value)" style="width:160px;">   
  <option value="" selected>--选择三级分类--</option>
</select></TD>
          </TR>	
		 <TR>
            <td width="17%" height="25" align="right" bgcolor="#EFF6FF">展会时间&nbsp;<font color="#FF0000">*</font></td>
           <TD width="83%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="start_time" id="start_time" type="text" size="15" maxlength="20">&nbsp;-&nbsp;<input name="end_time" id="end_time" type="text" size="15" maxlength="20">
            如：2010-01-20&nbsp;&nbsp;-&nbsp;&nbsp;2010-05-01</TD>
          </TR>	  
          <TR>
            <td height="25" align="right" bgcolor="#EFF6FF">展会描述&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><?php echo fck($value,'news_content',400);?></TD>
          </TR>
          <TR>
            <td height="25" align="right" bgcolor="#EFF6FF">展会图片&nbsp; </td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="picture" id="picture" type="text" size="35" maxlength="100">&nbsp;&nbsp;<input name="button" type="button" onClick="window.open ('../upfile.php', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')" value="上传图片">
            (图片限制650*180)</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">&nbsp;</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input type="submit" value="提交">
        <INPUT type="hidden" value="ok" name="act"></TD>
          </TR>
 </form>                
</TABLE>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");
?>
</div>
</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function checkform(){
   if($("news_title").value==""){
      alert("展会名称不能为空");
      $("news_title").focus();
      return false;
   }
   if($("news_keyword").value==""){
      alert("展会关键字不能为空");
      $("news_keyword").focus();
      return false;
   }
   if($("catalog_1").value==""){
      alert("请选择展会目录");
      $("catalog_1").focus();
      return false;
   }
   if($("catalog_2").value==""){
      alert("请选择二级目录");
      $("catalog_2").focus();
      return false;
   }

var pattern = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
if(!pattern.test($("start_time").value)){
	alert("日期不对");
	$("start_time").focus();
	return false;
	}

if(!pattern.test($("end_time").value)){
	alert("日期不对");
	$("end_time").focus();
	return false;
	}
 
}
</script>
